// pages/hotelfacilities/hotelfacilities.js
const app = getApp();

Page({
  /**
   * 页面的初始数据
   */
  data: {
    hotel_id:'',
    facilities_list:[
      {
        id:1,
        name:'wifi',
        isSupply:true,
        imgUrl:'../../images/big_avatar.png',
        un_imgUrl: '../../images/big_avatar.png',
      },
      {
        id: 2,
        name: '电脑',
        isSupply: true,
        imgUrl: '../../images/big_avatar.png',
        un_imgUrl: '../../images/big_avatar.png',
      },
      {
        id: 3,
        name: '24H热水',
        isSupply: true, 
        imgUrl: '../../images/big_avatar.png',
        un_imgUrl: '../../images/big_avatar.png',
      },
      {
        id: 4,
        name: '空调',
        isSupply: true,
        imgUrl: '../../images/big_avatar.png',
        un_imgUrl: '../../images/big_avatar.png', 
      },
      {
        id: 5,
        name: '免费洗漱品',
        isSupply: true,
        imgUrl: '../../images/big_avatar.png',
        un_imgUrl: '../../images/big_avatar.png',
      },
      {
        id: 6,
        name: '吹风机',
        isSupply: false,
        imgUrl: '../../images/big_avatar.png',
        un_imgUrl: '../../images/emptyStar.png',
      }
    ]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    console.log(options.id);

    var hotel_id = parseInt(options.id);
    this.setData({
      hotel_id: hotel_id
    })

    this.hotel_facilityList(hotel_id);
  },
  /**
   *酒店设施 
   */
  hotel_facilityList:function(id){
    var that = this;
    app.apiPost(app.apiList.hotel_facilityList, {
      content: {
        hotelId: id
      }
    }, function (res) {
       console.log(res,'酒店设施');
       that.setData({
         facilities_list: res.content
       })
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
  
  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
  
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
  
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})